//
//  AddUserViewController.m
//  SmartWatch
//
//  Created by zwj on 2022/11/24.
//

#import "AddUserViewController.h"

@interface AddUserViewController ()

@end

@implementation AddUserViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"添加用户";
    self.view.backgroundColor = BACKGROUNDCOLOR;
}

- (void)initSubviews {
    [super initSubviews];
    
    MyLinearLayout *root = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert];
    root.myHorzMargin = 15;
    root.myTop = NavigationContentTop + 15;
    root.subviewVSpace = 10;
    [self.view addSubview:root];
    
    MyLinearLayout *content = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert];
    content.myHorzMargin = 0;
    content.myTop = 0;
    content.padding = UIEdgeInsetsMake(20, 15, 0, 15);
    content.backgroundColor = COLOR_4;
    ViewCorner(content, 15);
    content.gravity = MyGravity_Horz_Center;
    [root addSubview:content];
    
    {
        
        
        
        NSArray *array = @[
        @{@"name":@"姓名或代号",@"content":@"请填写姓名或代号"},
        @{@"name":@"性别",@"content":@"请选择性别"},
        @{@"name":@"出生年月日",@"content":@"请选择出生年月日"},
        @{@"name":@"当前身高",@"content":@"请选择身高"},
        @{@"name":@"当前体重",@"content":@"请选择体重"},
        @{@"name":@"联系方式",@"content":@"请填写联系方式"},];
        for (int i = 0; i < array.count; i++) {
            if(i != 0){
                [content addSubview:[self setAddLineTop:i==0?20:0]];
            }
            
            MyLinearLayout *item = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Horz];
            item.myHorzMargin = 0;
            item.gravity = MyGravity_Vert_Center;
            item.myHeight = 50;
            item.subviewHSpace = 10;
            [content addSubview:item];

            {
                UILabel *name = [UILabel createLabelText:array[i][@"name"] font:UIFontMake(15) textColor:COLOR1515];
                name.mySize = kAutoSize;
                name.myWidth = 100;
                [item addSubview:name];
                
                UITextField * tf = UITextField.new;
                tf.weight = 1;
                NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:array[i][@"content"] attributes:
                                                             @{NSForegroundColorAttributeName:HexColor(@"#BABABA"),
                                                               NSFontAttributeName:UIFontMake(15)}
                ];
                tf.attributedPlaceholder = attrString;
                tf.myHeight = 30;
                tf.enabled = (0 < i && i < array.count - 1)?NO:YES;
                [item addSubview:tf];
                
                if(0 < i && i < array.count - 1){
                    UIImageView *right = [[UIImageView alloc]initWithImage:UIImageMake(@"icon_arrow_right")];
                    right.mySize = CGSizeMake(16, 16);
                    [item addSubview:right];
                }
            }
            
            
            
        }
    }
    
    UIButton *submitBtn = [UIButton createButtonText:@"提交" font:UIFontMake(14) textColor:COLOR_4];
    submitBtn.myHorzMargin = 0;
    submitBtn.myTop = 20;
    submitBtn.myHeight = 46;
    ViewCorner(submitBtn, 23);
    [submitBtn az_setGradientBackgroundWithColors:@[HexColor(@"#4BD8B1"),HexColor(@"#2CAED8")] locations:@[@0.0,@1.0] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 1)];
    [submitBtn addTarget:self action:@selector(submitBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [root addSubview:submitBtn];
}

- (void)submitBtnClick {
    
}
@end
